using System;
using System.Collections.Generic;
using Godot;

namespace Arcane.Source.Data;
public class RuneDB
{
    private readonly Dictionary<StringName, RuneProto> runes = [];

    public void Init(string path)
    {
        LoadUtil.LoadRecursive<RuneRes>(path, (id, res) => runes.Add(id, RuneProto.Create(res)), file => file.EndsWith("res"));
    }

    public RuneProto Get(StringName id) => runes.TryGetValue(id, out var proto) ? proto : null;
}